from django.conf.urls import patterns, include, url
import settings

# To enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',     
    #pages                   
    url(r'^$', 'main.views.index', name='home'),
    url(r'^home/$', 'main.views.index'),
    url(r'^login/$', 'auth.views.login_user'),
    url(r'^logout/$', 'auth.views.logout_view'),
    url(r'^register/$', 'auth.views.register_user'),
    
    #search
    (r'^search/', 'main.views.search'),
    
    #outcrop
    url(r'^outcrop/(?P<out_id>\d+)/$', 'main.views.view_outcrop'),
    url(r'^outcrop/(?P<out_id>\d+)/(?P<ex_id>\d+)/$', 'main.views.view_outcrop_excursion'),
    url(r'^outcrop/view_images/(?P<out_id>\d+)/(?P<img_id>\d+)/(?P<index>\d+)/$', 'userarea.views.outcrop_view_images'),
    #user
    url(r'^user/', include('userarea.urls'), name='userHome'),
    
    #admin
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    url(r'^admin/', include(admin.site.urls)),
    
    #comments
    url(r'^comments/', include('django.contrib.comments.urls')),
    
    #api
    url(r'^api/', include('api.urls')),
)

if settings.DEBUG:
    # static files (images, css, javascript, etc.)
    urlpatterns += patterns('',
        (r'^static_media/(?P<path>.*)$', 'django.views.static.serve', {
        'document_root': settings.MEDIA_ROOT}))